<#include "/common/h-ui-base-css.html">
<#include "/common/h-ui-base-js.html">
<#include "/common/validation-js.html">
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-project-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red">*</span>项目名称：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${project.proName!}" placeholder="" id="proName" name="proName">
			</div>
		</div>

		<#--<div class="row cl">-->
		<#--<label class="form-label col-xs-4 col-sm-3"  style="text-align: center"><span class="c-red">*</span>项目状态：</label>-->
		<#--<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:360px;">-->
		<#--<select class="select" name="proState" id="proState" size="1">-->
		<#--<option value="">---请选择项目状态---</option>-->
		<#--<#if proj_state??>-->
		<#--<#list proj_state as p>-->
		<#--<option value="${p.key}">${p.value}</option>-->
		<#--</#list>-->
		<#--</#if>-->
		<#--</select>-->
		<#--</span> </div>-->
		<#--</div>-->

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red"></span>项目分类：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${project.proCategory!}" placeholder="" id="proCategory" name="proCategory" >
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red"></span>项目资料地址：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${project.proLocation!}" placeholder="" id="proLocation" name="proLocation" >
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red"></span>项目所属公司ID：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${project.proCampanyid!}" placeholder="" id="proCampanyid" name="proCampanyid">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red"></span>项目所属公司：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${project.proCampany!}" placeholder="" id="proCampany" name="proCampany" >
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2" style="text-align: center"><span class="c-red"></span>项目标签：</label>
			<div class="formControls col-xs-8 col-sm-10">
				<input type="text" class="input-text" value="${project.proLabel!}" placeholder="" id="proLabel" name="proLabel" >
			</div>
		</div>

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>

	</form>
</article>
<!--请在下方写此页面业务相关的脚本-->


<script type="text/javascript">

    $("#form-project-add").validate({
        //校验
        rules: {
            proName: {
                required: true,
                isCheck: true,
                // minlength: 3,
                // maxlength: 16
            },
            proState: {
                required: true,
            }

        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            var id = ${project.id!-1}
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "/project-ins-upd-del/"+id,
                    //前台页面name需和实体属性对应
                    data :$("form-project-add").serialize(),
                    async:false,
                    success: function(data){
                        layer.msg('添加成功!',{icon:1,time:1000});
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg('error!',{icon:1,time:1000});
                    }
                });
            //跳转
            var index = parent.layer.getFrameIndex(window.name);
            var handler = '/project-list/1/20';
            parent.$('#project_table').datagrid('options').url = handler;
            parent.$('#project_table').datagrid('reload');
            parent.layer.close(index);
        }
    });
    jQuery.validator.addMethod("isCheck", function(value, element) {
        var id = ${project.id!-1};
        var flag = '';
        $.ajax({
            type :'post',
            url : '/project-check/'+value+'/'+id,
            async :false,
            success :function(data){
                flag = data;
            }
        });
        return this.optional(element) || ( flag!="error" );
    }, "项目名称重复，请重新输入");

</script>
<!--/请在上方写此页面业务相关的脚本-->

</body>
